package com.ocom.webapi.controller;

import com.ocom.common.constant.WebApiServiceUrl;
import com.ocom.common.entity.card.EntityXfVideocallGroup;
import com.ocom.common.entity.card.EntityXfVideocallInfo;
import com.ocom.common.request.videocall.request.*;
import com.ocom.common.resp.Result;
import com.ocom.webapi.feign.HumanClientService;
import com.ocom.webapi.feign.PayConfigClientService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@PreAuthorize("@pms.hasRole('ROLE_WEB')")
public class VideoCallController {

    @Autowired
    private PayConfigClientService payConfigClientService;
    @Autowired
    private HumanClientService humanClientService;

    @PostMapping(WebApiServiceUrl.URL_DeviceManageOnShow)
    public Result deviceManageOnShow(@RequestBody DeviceManageOnShowRequest request) {
        return payConfigClientService.getVideocallOnShow(request);
    }

    @PostMapping(WebApiServiceUrl.URL_DeviceManageAddGroup)
    public Result deviceManageAddGroup(@RequestBody EntityXfVideocallGroup request) {
        return payConfigClientService.addVideocallGroup(request);
    }

    @PostMapping(WebApiServiceUrl.URL_DeviceManageAddDevice)
    public Result deviceManageAddDevice(@RequestBody DeviceManageAddDeviceRequest request) {
        return payConfigClientService.addVideocall(request);
    }

    @PostMapping(WebApiServiceUrl.URL_DeviceManageUpdateDevice)
    public Result deviceManageUpdateDevice(@RequestBody DeviceManageUpdateDeviceRequest request) {
        return payConfigClientService.updateVideocall(request);
    }

    @PostMapping(WebApiServiceUrl.URL_DeviceManageActDevice)
    public Result deviceManageActDevice(@RequestBody DeviceManageActDeviceRequest request) {
        return payConfigClientService.actVideocall(request);
    }

    @PostMapping(WebApiServiceUrl.URL_DeviceManageRemoveDevice)
    public Result deviceManageRemoveDevice(@RequestBody DeviceManageRemoveDeviceRequest request) {
        return payConfigClientService.removeVideocall(request);
    }

    @PostMapping(WebApiServiceUrl.URL_DeviceManageOnShowDevice)
    public Result deviceManageOnShowDevice(@RequestBody DeviceManageOnShowDeviceRequest request) {
        return payConfigClientService.getNewVideocallList(request);
    }

    @PostMapping(WebApiServiceUrl.URL_DeviceManageOnShowAppInfo)
    public Result deviceManageOnShowAppInfo(@RequestBody DeviceManageOnShowAppInfoRequest request) {
        return payConfigClientService.getVideocallAppInfo(request);
    }
}
